/**
 * 一个二维地图。令当前持有记作has。
 * 如果四邻域中某一格的权值严格小于 has / X（X是事先给定的固定值），
 * 则可以将该格加入到当前领土，并将权值建入到has中。
 * 初始位于(P, Q)格子。问最终能够获得的最大的has是多少。
 * 显然在四领域中，应该优先处理权值小的。因此使用优先级队列，依次判断即可。
 */
#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std;

using Real = long double;
using llt = long long;
using vi = vector<int>;
using vll = vector<llt>;
using pii = pair<int, int>;
using pll = pair<llt, llt>;
using i128 = __int128_t;

int const DR[] = {-1, 1, 0, 0};
int const DC[] = {0, 0, -1, 1};

int H, W;
llt X;
int R, C;
vector<vll> Board;
vector<vi> Flag;

struct _t{
    int r;
    int c;
    llt w;
    _t(int a, int b, llt ww):r(a),c(b),w(ww){}
    bool operator < (const _t & right) const{
        if(w != right.w) return w > right.w;
        if(r != right.r) return r > right.r;
        return c > right.c;
    } 
};

void work(){
    cin >> H >> W >> X >> R >> C;
    Board.assign(H, vll(W, 0));
    for(auto & v : Board)for(auto & i : v)cin >> i;
    R -= 1, C -= 1;
    Flag.assign(H, vi(W, 0));
    Flag[R][C] = 1;

    priority_queue<_t> Q;
    llt ans = Board[R][C];
    for(int i=0;i<4;++i){
        int nr = R + DR[i];
        int nc = C + DC[i];
        if(0 <= nr and nr < H and 0 <= nc and nc < W){
            Q.push(_t(nr, nc, Board[nr][nc]));
            Flag[nr][nc] = 1;
        }
    }

    i128 x128 = X;
    while(not Q.empty()){
        auto h = Q.top(); Q.pop();
        if(ans > x128 * h.w){
            ans += h.w;
            for(int i=0;i<4;++i){
                int nr = h.r + DR[i];
                int nc = h.c + DC[i];
                if(0 <= nr and nr < H and 0 <= nc and nc < W and 0 == Flag[nr][nc]){
                    Q.push(_t(nr, nc, Board[nr][nc]));
                    Flag[nr][nc] = 1;
                }                
            }
        }
    }
    cout << ans << endl;
    return;
}

int main(){
#ifndef ONLINE_JUDGE
    freopen("z.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);	
    int nofkase = 1;
	// cin >> nofkase;
	while(nofkase--) work();
	return 0;
}